package practica12;

import org.antlr.runtime.Token;
import org.antlr.runtime.tree.CommonTree;
//import org.antlr.runtime.tree.Tree;

public class MyTree extends CommonTree{
	
    private boolean valid = false;

    private int column;
    private int line;
//    private String path;

    public MyTree() {

    }

    public MyTree(Token t) {
            super(t);

            if (t != null) {
                    column = t.getCharPositionInLine();
                    line = t.getLine();

                    valid = true;
            }
    }
    
    public MyTree (Token t, String ruta) {
    	super(t);
        if (t != null) {
            column = t.getCharPositionInLine();
            line = t.getLine();

            valid = true;
        }
//    	setPath(ruta);
    }

    public String toString() {

            StringBuffer sb = new StringBuffer("");

            sb.append(super.toString());

            if (valid) {
                    sb.append(" (line: " + getLine());
                    sb.append(", column: " + getColumn() + ")");
            }

            return sb.toString();
    }
    
	public int getLine() {
		return line;
	}

	public void setLine(int line) {
		this.line = line;
	}
	
	public int getColumn() {
		return column;
	}
	
	public void setColumn(int column) {
		this.column = column;
	}
//	
//	public String getPath() {
//		return path;
//	}
//	
//	public void setPath(String path) {
//		this.path = path;
//	}
}
